package org.ysu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.ysu.pojo.CCadre;
import org.ysu.pojo.VCadre;
import org.ysu.service.VCadreService;
import org.ysu.mapper.VCadreMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author libaoyu
* @description 针对表【v_cadre】的数据库操作Service实现
* @createDate 2024-06-17 14:59:30
*/
@Service
public class VCadreServiceImpl extends ServiceImpl<VCadreMapper, VCadre>
    implements VCadreService{
    @Resource
    private VCadreMapper vCadreMapper;
    @Override
    public VCadre getByIdNumber(String idNumber) {
        LambdaQueryWrapper<VCadre> wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(VCadre::getIdnumber,idNumber);
        VCadre vCadre=vCadreMapper.selectOne(wrapper);
        return vCadre;
    }

    @Override
    public Integer changeMaster(Integer vcid1, Integer vcid2) {
        return vCadreMapper.changeMaster(vcid1,vcid2);
    }

    @Override
    public VCadre getByName(String name) {
        LambdaQueryWrapper<VCadre> wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(VCadre::getName,name);
        VCadre vCadre=vCadreMapper.selectOne(wrapper);
        return vCadre;
    }
}




